function capHist=calculateCH(capHist,detections,r1,r2);
    [L,W]=size(capHist);
    [LL,W]=size(detections);
    if r2>LL
        r2=LL;
    end
    capHist(L+1,:)=[detections(r1,1),detections(r2,1), detections(r2,1)-detections(r1,1), detections(r1,2), detections(r1,3)];
    